import React, { Component } from 'react'
import empty from "../../assets/images/empty.jpg"
import "./Cart.scss"
export default class Cart extends Component {
    state = {
        carts:[]
    }
    componentDidCatch(){
        let carts_str = localStorage.getItem("carts");
        let carts = JSON.parse(carts_str||"[]");
        this.setState({
            carts
        })
    }
    render() {
        return (
            <div className="yg-cart">
                {
                    !!this.state.carts.length ?"":<div className="yg-cart-empty">
                    <img src={empty} className="cart-empty-img" alt=""/>
                     <h3 className="empty_text"><a href="#/category">去逛逛</a></h3>
            </div>
    }
    
    </div>
        )
    }
}
